<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Sites</title>
<link href="/css/admin.css" rel="stylesheet" type="text/css" />
<link href="/js/lightbox/lightbox.css" rel="stylesheet" type="text/css" />
<script src="/js/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="/js/lightbox/lightbox.js" type="text/javascript"></script>
<script type="text/javascript">
	$(function () {
		$('.commonTable tr').hover(function () {
			$(this).css('background-color', '#ffffae');
		},
        function () {
        	$(this).css('background-color', '#FFFFFF');
        });
		$("#div_bigthumbs").css("display","none");

		$(".lightbox").lightbox({
		    fitToScreen: true,
		    imageClickClose: false
	    });
     });

	
	function addtmpl()
	{
		window.location = "/cms/addtpl";
	}
	function edittmpl(tid)
	{
		window.location = "/cms/edittpl/" + tid;
	}
	function deltmpl(tid)
	{
		if(confirm('确定删除？'))
			window.location = "/cms/templates/del/" + tid;
	}
	function showBigThumbs(imgpath){
		window.open(imgpath,'','width=500,height=300,left=' + (screen.availWidth - 500) / 2 + ',top=' + (screen.availHeight - 300) / 2);
	}
</script>
<style type="text/css">
	img{border:none;}
	.handimg{cursor:pointer;}
</style>
</head>
<body>
	<div class="listTitle">模板管理</div>
	<div class="btnDiv"><input type="button" value="添加模板" onclick="addtmpl()" /></div>
	<div><table class="commonTable" width="100%" cellspacing="0" cellpadding="5" >
	    <tr>
	    	<th>编号</th>
		    <th>名称</th>
		    <th>类型</th>
			<th>描述</th>
			<th>缩略图</th>
		    <th width="60" >
		    </th>
	    </tr>
		<?php foreach ($query->result_array() as $row){?>
			<tr>
			<td><?=$row['tid']?></td>
			<td><?=$row['tname']?></td>
			<td><?php switch($row['ttype']){
				case '0':
					echo('首页模板');
					break;
				case '1':
					echo('栏目模板');
					break;
				case '2':
					echo('文档模板');
					break;
			}?></td>
			<td><?=$row['descr']?></td>
			<td><?php if(!empty($row['thumbs'])){?><a href="<?=$row['thumbs']?>" class="lightbox"><img class="handimg" src="<?=str_replace('/images/', '/_thumbs/images/',$row['thumbs']) ?>" /></a><?php }?></td>			
			<td><a href="javascript:edittmpl('<?=$row['tid']?>')">编辑</a>&nbsp;<a href="javascript:deltmpl('<?=$row['tid']?>') ">删除</a></td>
			</tr>
		<?php } ?>
	</table></div>
</body>
</html>